package 锁;
//线程不安全问题

public class Demo_1 {
    public static int count = 0;
    static Object o =new Object();

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
            for (int i = 0; i < 5_0000; i++) {
                count++;
            }
        });

        Thread thread1 =new Thread(()->{
            for (int i = 0; i < 5_0000; i++) {
                count++;
            }
        });

        thread.start();
        thread1.start();


        thread.join();
        thread1.join();

        System.out.println("count: "+count);
    }
}
